//
//  RxSwift+.swift
//  HoneyChat
//
//  Created by hccc on 2023/3/20.
//

import Foundation
import RxSwift

public extension Notification.Name {
    func rx() -> Observable<Notification> {
        NotificationCenter.default.rx.notification(self)
    }

    func post(object: Any? = nil, userInfo: [AnyHashable: Any]? = nil) {
        NotificationCenter.default.post(name: self, object: object, userInfo: userInfo)
    }
}

extension ObservableType {
//    public func subscribe(onSuccess: ((Element) -> Void)?,
//                          onError: ((Swift.Error) -> Void)? = nil,
//                          onCompleted: (() -> Void)? = nil,
//                          onDisposed: (() -> Void)? = nil) -> Disposable {
//        return self.subscribe(onNext: onSuccess, onError: onError, onCompleted: onCompleted, onDisposed: onDisposed)
//    }

    func mapVoid() -> Observable<Void> {
        map { _ in
            ()
        }
    }
}
